package com.wen.business.service.impl;

import com.wen.business.service.Test;

public class TestImpl implements Test {

    private int point;
    private TestImpl next;

    public TestImpl(){
        System.out.println("new  :"+ ++point);
    }
    @Override
    public void show11() {
        System.out.println("函数式接口");

        Test t =  ()->{
            System.out.println("");
        };
    }

    public TestImpl next(TestImpl next){

        // 第二个
        if (this.next==null) {
            this.next = next;
            return this;
        }
// 第三个...
        TestImpl last = this.next;
        // 移动最后一个的指向
        while (last.next!=null){
            System.out.println("移动最后一个的指向");
            last = last.next;
        }
        last.next = next;

        return this;
    }

    public static void main(String[] args) {
        TestImpl impl = new TestImpl().next(new TestImpl()).next(new TestImpl()).next(new TestImpl()).next(new TestImpl()).next(new TestImpl());

        System.out.println(impl.toString());
    }
}
